/**
 * Project Name:springBoot-serviceImpl
 * File Name:IoConfig.java
 * Package Name:com.libra.rabbitmq.config
 * Date:2018年8月28日上午10:49:54
 * Copyright (c) 2018, wangzhch All Rights Reserved.
 *
*/

package com.libra.config;

import javax.servlet.MultipartConfigElement;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * ClassName:IoConfig <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason:	 TODO ADD REASON. <br/>
 * Date:     2018年8月28日 上午10:49:54 <br/>
 * @author   wangzhch
 * @version  
 * @since    JDK 1.8
 * @see 	 
 */
@Configuration
public class IoConfig {
	@Value("${multipart.maxFileSize}")
	private String maxFileSize;
	@Value("${multipart.maxRequestSize}")
	private String maxRequestSize;
	/**
	 * 
	 * multipartConfigElement:(文件上传大小配置). <br/>
	 * @author wangzhch
	 * @param maxFileSize 单个文件最大
	 * @param maxRequestSize 总上传数据总大小
	 * @return
	 * @since JDK 1.8
	 */
	@Bean
	public MultipartConfigElement multipartConfigElement() {
		MultipartConfigFactory multipartConfigFactory = new MultipartConfigFactory();
		multipartConfigFactory.setMaxFileSize(maxFileSize);
		multipartConfigFactory.setMaxRequestSize(maxRequestSize);
		return multipartConfigFactory.createMultipartConfig();
	}
}

